<%@ page import="avishay.balderman.dao.*" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 

<%
	UserService userService = UserServiceFactory.getUserService();
	final String thisURL = request.getRequestURI();
	final String loginURL = userService.createLoginURL(thisURL);
	boolean isLoggedIn = userService.isUserLoggedIn();
	if(!isLoggedIn)
	{
		response.sendRedirect(loginURL);
	}
	boolean isAdmin = userService.isUserAdmin();
	if(!isAdmin)
	{
		response.sendRedirect(loginURL);
	}

	if ( request.getParameter("firstName") != null ) 
    {
    	TeamMemberHelper.addTeamMember(request);	
    }
%>
 
<head> 
	<title>Add link</title> 
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
	<link rel="stylesheet" type="text/css" href="../css/style.css" /> 
</head> 
 
<body> 
	<div id="page-wrap"> 
	    Add new team member:
		<div id="contact-area"> 
			<form method="post" action="/jsp/add_member.jsp"> 
				<label for="firstName">First Name:</label> 
				<input type="text" name="firstName" id="firstName" /> 
				
				<label for="lastName">Last Name:</label> 
				<input type="text" name="lastName" id="lastName" /> 
				
				<label for="email">Email:</label> 
				<input type="text" name="email" id="email" />	
				
				<label for="address">Address:</label> 
				<input type="text" name="address" id="address" />	
				
				<label for="phoneNumbers">Phone numbers:</label> 
				<input type="text" name="phoneNumbers" id="phoneNumbers" title="Comma seperated list"/>					
 
				<input type="submit" name="submit" value="Submit" class="submit-button" /> 
			</form> 
			<div style="clear: both;"></div> 
		</div> 
	</div> 
</body> 
</html>